package leetcode.offer_two_special.binary;

/**
 * @author mazouri
 * @create 2021-09-21 12:52
 */
public class _69_peakIndexInMountainArray {
    public int peakIndexInMountainArray(int[] arr) {
        for (int i = 1; i < arr.length - 1; i++) {
            if (arr[i] > arr[i - 1] && arr[i] > arr[i + 1]) return i;
        }
        return 0;
    }

    public static void main(String[] args) {
        System.out.println(new _69_peakIndexInMountainArray()
                .peakIndexInMountainArray(new int[]{3,4,5,1}));
    }
}
